1. Field of the Invention
The present invention relates to a computer system with an access control unit for controlling a resource shared by a plurality of tasks in an exclusive manner or in a shared manner.
2. Description of the Related Art
In a computer system employing a multi-task OS (operating system) a plurality of tasks share a single resource, and each task may access the resource if required. Here, the resource has a file unit, such as a hard disk unit.
The computer system includes a file access controller system. When a task issues an access request to the file unit, the file access controller receives the access request and accesses a record specified by the access request from the file unit. More specifically, the file access controller checks whether or not the record specified by the access request has been recorded in a file control block (FCB) as previously provided. If it is recorded, the file access controller checks whether or not the task number of the task locking the record is the same as that of the task making the access request. Where a record is previously assigned to the task, its task number and a resource name (record name) are recorded in the FCB. Accordingly, when the recorded resource name is coincident with that of the task making the access request, the resource has been assigned and locked by the task making the access request.
When the record under the access request is not recorded in the FCB, the file access controller records a task number of the task and a resource number in the FCB, locks the record, and accesses the record from the file unit. When another task makes an access to the locked record, the file access controller performs an exclusive control in which it prohibits the resource from being accessed until the record is released from its locked state. More exactly, the file access controller compares the task number of the task making an access request and the task number recorded in the FCB. If those task numbers are not coincident with each other, the file access controller places the task requesting the access in a wait status until the record is released from its locked state.
As described above, the file access controller makes the exclusive control of a resource which is assigned to a task and locked, in accordance with a task number recorded in the FCB. In the multi-task system, when a first task (main task) and a second task (sub task), which execute related data processings, access a resource shared by them, the resource (record) under the access request made by the main task is locked, and rejects the access by another task. That is, it is placed in an exclusive control mode. Accordingly, if the sub task accesses the record locked by the main task, the access by the sub task is rejected until the record is released from the locked state. Thus, the file access controller does not consider the access request by the sub task to be equal to that by the main task, because the task numbers are different, and places the resource in the exclusive control mode.
Where the related tasks are present, and those tasks access the shared resource, if a deadlock phenomenon occurs that the access to the resource by the second task is prohibited by the first task, the efficiency of access to the resource is reduced, and consequently data processing efficiency is reduced.